<template>
  <div :id="config.option.id" class="strut-div">
    <el-table
      :data="tableData"
      :height="config.option.height"
      :border="false"
      :highlight-current-row="false"
      :header-row-style="{ color: config.option.tableColor }"
      header-row-class-name="table-header"
      row-class-name="table-body"
      style="width: 100%;text-align: center"
    >
      <el-table-column show-overflow-tooltip :type="item.type" :prop="item.prop" :label="item.title" v-for="item in config.option.tableHeader" :key="item.prop" :width="item.width"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import autoScroll from '../../util/autoScroll.js';

export default {
  props: ['config'],
  data() {
    return {
      tableData: [],
      interval: null
    };
  },
  methods: {
    initTable() {
      setTimeout(() => {
        this.tableData = this.config.option.tableData;
        this.interval = autoScroll.autoScrollTable(this.config.option.id);
      }, 300);
    },
    handleClick(tab, event) {
      console.log(tab, event);
    },
    formatter(row, column) {
      return row.address;
    }
  },
  mounted() {
  },
  beforeDestroy() {
    autoScroll.cancelScroll(this.interval);
  }
};
</script>

<style lang="scss" type="text/scss">
.strut-div .table-header {
  height: 35px;
  background-color: rgba(38, 74, 125, 0.5);
  > th {
    height: 35px;
    padding: 0;

    > .cell {
      height: 35px;
      line-height: 35px;
      font-size: 15px !important;
      background-color: transparent !important;
    }
  }
}

.el-table th,
.el-table tr {
  background-color: #1b345a;
  text-align: center;
}

.table-body {
  background-color: transparent !important;
  height: 35px !important;
  line-height: 35px !important;
  font-size: 17px;
  > td {
    padding: 0;
    text-align: center;
  }

  color: #eaf4ff;
}

/* 用来设置当前页面element全局table的内间距 */
.el-table__row td {
  padding: 0;
  >.cell {
    font-size: 14px;
    // display: -webkit-box;
    // -webkit-box-orient: vertical;
    // -webkit-line-clamp: 3;
  }
}

/* 用来设置当前页面element全局table 选中某行时的背景色*/
.el-table__body tr.current-row > td {
  background-color: #1c4c7d !important;
  /* color: #f19944; */
  /* 设置文字颜色，可以选择不设置 */
}

/* 用来设置当前页面element全局table 鼠标移入某行时的背景色*/
.el-table--enable-row-hover .el-table__body tr:hover > td {
  background-color: #1c4c7d;
  /* color: #f19944; */
  /* 设置文字颜色，可以选择不设置 */
}

/*chrome滚动条颜色设置*/

*::-webkit-scrollbar {
  width: 0px;
  height: 10px;
  background-color: transparent;
}

/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
*::-webkit-scrollbar-track {
  background-color: #000000;
}

/*定义滚动条轨道 内阴影+圆角*/
*::-webkit-scrollbar-thumb {
  background-color: #176ca0;
  border-radius: 6px;
}

/*定义滑块 内阴影+圆角*/
.scrollbarHide::-webkit-scrollbar {
  display: none;
}

.scrollbarShow::-webkit-scrollbar {
  display: block;
}
</style>
